<?php

namespace app\controller;

use app\BaseController;
use app\model\Headlines;
use think\facade\Request;

class Api extends BaseController
{
    public function add()
    {
        $item = Request::param();
        $obj = new Headlines;
        $obj->save($item);
        return 200;
    }

    public function update()
    {
        $item = Request::param();
        $obj = new Headlines;
        $obj->saveAll([$item]);
        return 200;
    }

    public function delete()
    {
        $id = Request::param('id');;
        $item = Headlines::find($id);
        $item->delete();
        return 200;
    }
}
